package dao.impl;

import dao.PlanDao;
import pojo.Plan;

import java.sql.SQLException;
import java.util.List;

public class PlanDaoImpl extends BaseDao implements PlanDao {
    @Override
    public int saveplan(Plan plan) throws SQLException {
        String sql = "insert into plan values(?,?,?,?)";
        return update(sql,plan.getCid(),plan.getModule(),plan.getTime(),plan.getUid());
    }

    @Override
    public List<Plan> getAllPlan(String uid) throws SQLException {
        String sql = "select * from plan where uid = ?";
        return queryForList(Plan.class,sql,uid);
    }

    @Override
    public Plan getOnePlan(String time) throws SQLException {
        String sql = "select * from plan where time = ?";
        return queryForOne(Plan.class,sql,time);
    }
}
